// JavaScript Document
$(function(){
	(function(){
		var i = 0; //记录当前处于第几个显示
		var timespace = 2000; //轮播间隔
		var scroll = $('#scroll').find('ul');
		var roll = $(scroll.get(0));
		var ball = $(scroll.get(1));
		var len = $(roll).children().length;
		
		function scrolling(){
			roll.animate({left: - (i*100) + '%'}, 200);
			ball.find('li').removeClass('ball_now').end().find('li:eq('+ i +')').addClass('ball_now');
			
			i++;
			if(i == len){ //循环
				i = 0;
			}
		}
		
		var timer = window.setInterval(scrolling, timespace);
	})();
});